Described in Patent Documents 1 to 3 are position detectors in which a position of a movable member is detected by a magnetic field detecting means as a change of magnetic field caused by a magnetic field generating member attached to the movable member.    Patent document 1: JP H01-150812 A    Patent document 2: JP 2004-348173 A    Patent document 3: JP 2001-91298 A
FIG. 11 shows a position detector 31 described in Patent Document 1. The position detector 31 uses a magnetic field detecting means 33 to detect a change of magnetic field generated by a magnetic field generating member 32, and calculates the position of the magnetic field generating member 32. A half of the magnetic field generating member 32 is an N-pole portion 34 magnetized to be N-pole, while the other half is an S-pole portion 35 magnetized to be S-pole.
When the magnetic field generating member 32 is 6.5 mm in length in a movable direction, 2.5 mm in width, and 1 mm in thickness, a flux density distribution as shown in FIG. 12 is acquired. This position detector 31 has the problem that an accurate position can be detected only in the narrow range where a change of a flux density is linear.
Moreover, in Patent Document 1, the magnetic field detecting means 33 is composed of two Hall elements (magnetic field detecting elements) 36a and 36b, and a change of magnetic field due to temperature change and the like is compensated by varying an input current with use of a difference between outputs by two Hall elements 36a and 36b. In Patent Document 2, the sum of the outputs of two Hall elements (magnetic field detecting elements) 36a and 36b is divided by a difference between the outputs, by which a change of magnetic field due to a mounting error of the magnetic field generating member 32 and the magnetic field detecting means 33, temperature change and the like is compensated.
FIG. 13 shows a change of an output obtained by dividing the sum of the outputs by a difference between the outputs when the magnetic field detection centers of two Hall elements 36a and 36b are distanced by 1.6 mm. Naturally, this operation does not spread the linear range where the output is linear, and the problem that the position can be detected only in the narrow range still remains.
In Patent Document 3, a position detector is described which generates magnetic flux using a wedge-shaped magnet, the magnetic flux being linearly changed by the position of a magnetic field generating member. However, such a position detector has the problem that an error and individual difference are large because a magnetic field changes when a relative position shifts in the direction perpendicular to the movable direction of the magnetic field generating member and a magnetic field detecting means.